<?php
$thisclass  = & class_info($this_cata_id);
listseo($thisclass);
$save	= @(int)$_POST['save'];
$chknumber	= trim($_POST['chknumber']);
if($save	== 1) {
    if($chknumber	!= $_SESSION['randcode']) {
        $info='验证码有误！';
        $second = '3';
        $urlnamedd='留言';
        $url    = "$G_web_root/about/msg.php";
        $msg    = '<font style="color:red">操作失败！</font>';
        $tpl->assign(get_defined_vars());
        $tpl->display('showmessage.html');
    	exit();
    }
    $tbl_main   = $_TABLES['faq'];
    $conn   = & get_db_conn();
    $result['subject']= trim($_POST['sub']);
    $result['content']= trim($_POST['content']);
    $result['sender']= trim($_POST['name']);
    $result['senderemail']= trim($_POST['email']);
    $result['senderphone']= trim($_POST['phone']);
    $result['sendtime']=$timestamp;
    $result['ip']=realip();
    $sql = "SELECT COUNT(*) AS rs_count FROM $tbl_main WHERE subject = '{$result['subject']}' and content = '{$result['content']}' and sender = '{$result['sender']}' and senderemail = '{$result['senderemail']}' and senderphone = '{$result['senderphone']}' and ip = '{$result['ip']}' ";
    $rs = $conn->GetOne($sql);
    if($rs) {
        $info='同样的内容已被提交!';
        $second = '3';
        $urlnamedd='留言';
        $url    = "$G_web_root/about/msg.php";
        $msg    = '<font style="color:red">操作失败！</font>';
        $tpl->assign(get_defined_vars());
        $tpl->display('showmessage.html');
    	exit();
    } else {
        $conn->AutoExecute($tbl_main,$result,'INSERT');
        $id = $conn->Insert_ID();
        if($id){
            $info='留言成功！';
            $url="$G_web_root/about/msg.php";
            $second = '3';
            $urlnamedd='留言';
            $msg    = '操作成功';
            $tpl->assign(get_defined_vars());
            $tpl->display('showmessage.html');
        	exit();
        }else{
            $info='提交失败，请重试！';
            $second = '3';
            $urlnamedd='留言';
            $url    = "$G_web_root/about/msg.php";
            $msg    = '<font style="color:red">操作失败！</font>';
            $tpl->assign(get_defined_vars());
            $tpl->display('showmessage.html');
        	exit();
        }
    }
}
$tpl->assign(array(
    'seo_title'     => '留言板_'.$seo_title,
    'seo_keywords'  => $seo_keywords,
    'seo_description' => $seo_description,
));
$tpl->display($tpl_msg);
?>